{extend name="base" /}
{block name="body"}
<div class="layui-card">
    <div class="layui-card-body">
        <form action="{:request()->url()}" class="layui-form" method="post">
            <div class="layui-form-item">
                <label class="layui-form-label">合同时间</label>
                <div class="layui-input-inline">
                    <input type="text" name="start_time" value="{$data.start_time|default=''}" class="layui-input" id="start" placeholder="合同开始时间">
                </div>
                <div class="layui-input-inline">
                    <input type="text" name="end_time" value="{$data.end_time|default=''}" class="layui-input" id="end" placeholder="合同到期时间">
                </div>
            </div>
            
            <div class="layui-form-item">
                <label class="layui-form-label">合同文件</label>
                <div class="layui-input-block">
                    <input type="text" name="file" value="{$data.file|default=''}" autocomplete="off" placeholder="请上传" class="layui-input" lay-verify="required">
                    <button type="button" class="layui-btn layui-btn-primary layui-btn-position ajax-file"><i class="fa fa-file-image-o"></i> 选择文件</button>
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">合同图片</label>
                <div class="layui-input-inline" style="width:112px;">
                    <input type="hidden" name="photo">
                    <button type="button" class="layui-btn layui-btn-primary ajax-photos"><i class="fa fa-file-image-o"></i> 选择图片</button>
                </div>
                <div class="layui-form-mid layui-word-aux">允许多文件上传，不支持ie8/9</div>
            </div>
            {if condition="!empty($data['photo'])"}
            {foreach name="data.photo" item="v"}
            <div class="layui-col-md3">
                <div class="layui-form-item">
                    <div class="layui-input-block">
                        <input type="hidden" name="photo[]" value="{$v}" autocomplete="off" readonly class="layui-input">
                        <img src="{$v}" width="85" height="85" class="layui-upload-img"><br>
                        <button type="button" class="layui-btn layui-btn-danger layui-btn-sm delete-photo"><i class="fa fa-times-circle"></i> 删除图片</button>
                    </div>
                </div>
            </div>
            {/foreach}
            {/if}
            <div class="layui-form-item layui-form-text">
                <label class="layui-form-label">合同备注</label>
                <div class="layui-input-block">
                    <textarea name="remark" class="layui-textarea" style="height:150px">{$data.remark|default=''}</textarea>
                </div>
            </div>
            
            <div class="layui-form-item">
                <div class="layui-input-block">
                    <button class="layui-btn" lay-filter="i" lay-submit="">保存</button>
                    <button class="layui-btn layui-btn-primary" type="reset">重置</button>
                </div>
            </div>
        </form>
    </div>
</div>
{/block}
{block name="js"}
<script type="text/javascript">
    laydate.render({
        elem: '#start',
    });
    laydate.render({
        elem: '#end',
    });
    
</script>
{/block}
